﻿using Architecture.Api.Application.Commands.CorporationCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domain.TraceabilityManage;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.CorporationHandler
{
    public class CorporationUpdateCommandHandler : IRequestHandler<CorporationUpdateCommand, int>
    {
        private readonly ICultureService _cultureService;

        public CorporationUpdateCommandHandler(ICultureService cultureService)
        {
            _cultureService = cultureService;
        }

        public Task<int> Handle(CorporationUpdateCommand request, CancellationToken cancellationToken)
        {
            return _cultureService.UpdateCorporation(new Corporation()
            {
                CId = request.CId,
                //养殖
                BreedingQuantity = request.BreedingQuantity,
                CompanyName = request.CompanyName,
                ProductionLot = request.ProductionLot,
                HeadOfBreeding = request.HeadOfBreeding,
                CompanyPicture = request.CompanyPicture,
            });
        }
    }
}
